﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using Library;
using System.Windows.Forms;
using System.Diagnostics;


namespace QLCF
{
    [RunInstaller(true)]
    public partial class Installer1 : System.Configuration.Install.Installer
    {
        public Installer1()
        {
            InitializeComponent();
        }
        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Install(IDictionary stateSaver)
        {
            
            base.Install(stateSaver);
            //using (Process registryInput = Process.Start("regedit.exe", "/s Settings1.reg"))
            //{
            //    registryInput.WaitForExit();
            //}

            //using (Process registryInput = Process.Start("regedit.exe", "/s Settings2.reg"))
            //{
            //    registryInput.WaitForExit();
            //}                        
            clsDropDB clsDB = new clsDropDB();
            clsDB.DropDatabase("QLCF","");
        }

        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Commit(IDictionary savedState)
        {
            base.Commit(savedState);
        }

        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Rollback(IDictionary savedState)
        {
            base.Rollback(savedState);
        }

        [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
        public override void Uninstall(IDictionary savedState)
        {            
            base.Uninstall(savedState);
            clsDropDB clsDB = new clsDropDB();
            clsDB.DropDatabase("QLCF", "");              
        }
    }
}
